package org.zjx.resource;

import lombok.Getter;

import javax.crypto.SecretKey;
import java.awt.*;

public interface IBaseConfig {

    @Getter
    enum GameResolution {
        GAME_RES_640_480("640x480"),
        GAME_RES_800_600("800x600"),
        GAME_RES_1024_768("1024x768"),
        GAME_RES_1024_768HD("1024x768HD"),
        GAME_RES_1080_960HD("1280x960HD");

        private final String suffix;
        private final int  width;
        private final int  height;

        GameResolution(String suffix) {
            this.suffix = suffix;

            String[] att = suffix.split("x");

            this.width = Integer.parseInt(att[0]);
            this.height = Integer.parseInt(att[1].replace("HD", ""));
        }



    }

    @Getter
    enum GameTheme {
        GAME_THEME_CLASSIC("经典"),
        GAME_THEME_RHYME("国韵"),
        GAME_THEME_WARM("暖风"),
        GAME_THEME_CRYSTAL("水晶"),
        GAME_THEME_ELEGANT("雅致");

        private final String suffix;

        GameTheme(String suffix) {
            this.suffix = suffix;
        }
    }


    /**
     * 游戏快捷键路径
     */
    String gameInkPath();

    /**
     * 服务器IP
     */
    String getHost();

    /**
     * 服务器端口
     */
    int getPort();

    /**
     * 资源路径 本地路径
     */
    String getResourcePath();

    /**
     * 资源是否加密
     */
    boolean isEncryptor();

    /**
     * 设置资源是否加密
     */
    void setEncryptor(boolean encryptor);

    /**
     * 资源文件 密钥
     */
    SecretKey getResSecretKey();

    /**
     * 设置密钥
     */
    void setResSecretKey(SecretKey secretKey);

    /**
     * 桌面运行窗口数量
     */
    int gameThreadSize();

    /**
     * 风格
     */
    GameTheme theme();

    /**
     * 像素
     */
    GameResolution resolution();

    /**
     * 是否开启错误识别（道具/识字） 记录
     */
    boolean isRecordIdentifyError();


    default Point getWindowSize() {
        return new Point(resolution().width, resolution().height);
    }
}
